/*
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License");  you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 * http//www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * The Original Code is ART OWL API.
 *
 * The Initial Developer of the Original Code is University of Roma Tor Vergata.
 * Portions created by University of Roma Tor Vergata are Copyright (C) 2009.
 * All Rights Reserved.
 *
 * The ART OWL API were developed by the Artificial Intelligence Research Group
 * (art.uniroma2.it) at the University of Roma Tor Vergata
 * Current information about the ART OWL API can be obtained at 
 * http://art.uniroma2.it/owlart
 *
 */

package it.uniroma2.art.owlart.models.impl;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URL;

import java.util.Map;

import it.uniroma2.art.owlart.exceptions.ModelAccessException;
import it.uniroma2.art.owlart.exceptions.ModelUpdateException;
import it.uniroma2.art.owlart.exceptions.UnsupportedQueryLanguageException;
import it.uniroma2.art.owlart.exceptions.UnsupportedRDFFormatException;
import it.uniroma2.art.owlart.io.RDFFormat;
import it.uniroma2.art.owlart.model.ARTBNode;
import it.uniroma2.art.owlart.model.ARTLiteral;
import it.uniroma2.art.owlart.model.ARTNode;
import it.uniroma2.art.owlart.model.ARTResource;
import it.uniroma2.art.owlart.model.ARTStatement;
import it.uniroma2.art.owlart.model.ARTURIResource;
import it.uniroma2.art.owlart.models.BaseRDFTripleModel;
import it.uniroma2.art.owlart.navigation.ARTNamespaceIterator;
import it.uniroma2.art.owlart.navigation.ARTResourceIterator;
import it.uniroma2.art.owlart.navigation.ARTStatementIterator;
import it.uniroma2.art.owlart.query.BooleanQuery;
import it.uniroma2.art.owlart.query.GraphQuery;
import it.uniroma2.art.owlart.query.MalformedQueryException;
import it.uniroma2.art.owlart.query.Query;
import it.uniroma2.art.owlart.query.QueryLanguage;
import it.uniroma2.art.owlart.query.TupleQuery;

/**
 * Standard implementation of {@link BaseRDFTripleModel} which simply wraps an existing implementation of
 * {@link BaseRDFTripleModel}.<br/>
 * The reason for this is that this container class is further extended by other implementation classes
 * present in this library
 * 
 * @author Armando Stellato
 * 
 */
public class BaseRDFModelImpl implements BaseRDFTripleModel {

	protected BaseRDFTripleModel baseRep;

	public BaseRDFModelImpl(BaseRDFTripleModel baseRep) {
		this.baseRep = baseRep;
	}

	public void addRDF(File inputFile, String baseURI, RDFFormat rdfFormat, ARTResource... contexts)
			throws FileNotFoundException, IOException, ModelAccessException, ModelUpdateException,
			UnsupportedRDFFormatException {
		baseRep.addRDF(inputFile, baseURI, rdfFormat, contexts);
	}

	public void addRDF(URL url, String baseURI, RDFFormat rdfFormat, ARTResource... contexts)
			throws FileNotFoundException, IOException, ModelAccessException, ModelUpdateException,
			UnsupportedRDFFormatException {
		baseRep.addRDF(url, baseURI, rdfFormat, contexts);
	}

	public ARTBNode createBNode() {
		return baseRep.createBNode();
	}

	public ARTBNode createBNode(String ID) {
		return baseRep.createBNode(ID);
	}

	public ARTLiteral createLiteral(String literalString) {
		return baseRep.createLiteral(literalString);
	}

	public ARTLiteral createLiteral(String literalString, String language) {
		return baseRep.createLiteral(literalString, language);
	}

	public ARTURIResource createURIResource(String uri) {
		return baseRep.createURIResource(uri);
	}

	public void deleteTriple(ARTResource subject, ARTURIResource property, ARTNode object,
			ARTResource... contexts) throws ModelUpdateException {
		baseRep.deleteTriple(subject, property, object, contexts);
	}

	public void deleteStatement(ARTStatement statement, ARTResource... contexts) throws ModelUpdateException {
		baseRep.deleteStatement(statement, contexts);
	}

	public void clearRDF(ARTResource... graphs) throws ModelUpdateException {
		baseRep.clearRDF(graphs);
	}

	public String getBaseURI() {
		return baseRep.getBaseURI();
	}

	public String getDefaultNamespace() {
		return baseRep.getDefaultNamespace();
	}

	public ARTStatementIterator listStatements(ARTResource subj, ARTURIResource pred, ARTNode obj,
			boolean inferred, ARTResource... contexts) throws ModelAccessException {
		return baseRep.listStatements(subj, pred, obj, inferred, contexts);
	}

	public boolean hasTriple(ARTResource subj, ARTURIResource pred, ARTNode obj, boolean inferred,
			ARTResource... contexts) throws ModelAccessException {
		return baseRep.hasTriple(subj, pred, obj, inferred, contexts);
	}

	public boolean hasStatement(ARTStatement stat, boolean inferred, ARTResource... contexts)
			throws ModelAccessException {
		return baseRep.hasStatement(stat, inferred, contexts);
	}

	public ARTNamespaceIterator listNamespaces() throws ModelAccessException {
		return baseRep.listNamespaces();
	}

	public void setBaseURI(String uri) throws ModelUpdateException {
		baseRep.setBaseURI(uri);
	}

	public void setDefaultNamespace(String namespace) throws ModelUpdateException {
		baseRep.setDefaultNamespace(namespace);
	}

	public void writeRDF(File outputFile, RDFFormat rdfFormat, ARTResource... contexts) throws IOException,
			ModelAccessException, UnsupportedRDFFormatException {
		baseRep.writeRDF(outputFile, rdfFormat, contexts);
	}

	public void writeRDF(OutputStream outputStream, RDFFormat rdfFormat, ARTResource... contexts)
			throws IOException, ModelAccessException, UnsupportedRDFFormatException {
		baseRep.writeRDF(outputStream, rdfFormat, contexts);
	}

	public String expandQName(String qname) throws ModelAccessException {
		return baseRep.expandQName(qname);
	}

	public String getNSForPrefix(String prefix) throws ModelAccessException {
		return baseRep.getNSForPrefix(prefix);
	}

	public Map<String, String> getNamespacePrefixMapping() throws ModelAccessException {
		return baseRep.getNamespacePrefixMapping();
	}

	public String getPrefixForNS(String namespace) throws ModelAccessException {
		return baseRep.getPrefixForNS(namespace);
	}

	public String getQName(String uri) throws ModelAccessException {
		return baseRep.getQName(uri);
	}

	public void removeNsPrefixMapping(String namespace) throws ModelUpdateException {
		baseRep.removeNsPrefixMapping(namespace);

	}

	public void setNsPrefix(String namespace, String prefix) throws ModelUpdateException {
		baseRep.setNsPrefix(namespace, prefix);
	}

	public void addStatement(ARTStatement stat, ARTResource... contexts) throws ModelUpdateException {
		baseRep.addStatement(stat, contexts);

	}

	public void addTriple(ARTResource subject, ARTURIResource predicate, ARTNode object,
			ARTResource... contexts) throws ModelUpdateException {
		baseRep.addTriple(subject, predicate, object, contexts);

	}

	public void close() throws ModelUpdateException {
		baseRep.close();
	}

	public ARTResourceIterator listNamedGraphs() throws ModelAccessException {
		return baseRep.listNamedGraphs();
	}

	public BooleanQuery createBooleanQuery(QueryLanguage ql, String query, String baseURI)
			throws UnsupportedQueryLanguageException, ModelAccessException, MalformedQueryException {
		return baseRep.createBooleanQuery(ql, query, baseURI);
	}

	public GraphQuery createGraphQuery(QueryLanguage ql, String query, String baseURI)
			throws UnsupportedQueryLanguageException, ModelAccessException, MalformedQueryException {
		return baseRep.createGraphQuery(ql, query, baseURI);
	}

	public Query createQuery(QueryLanguage ql, String query, String baseURI)
			throws UnsupportedQueryLanguageException, ModelAccessException, MalformedQueryException {
		return baseRep.createQuery(ql, query, baseURI);
	}

	public TupleQuery createTupleQuery(QueryLanguage ql, String query, String baseURI)
			throws UnsupportedQueryLanguageException, ModelAccessException, MalformedQueryException {
		return baseRep.createTupleQuery(ql, query, baseURI);
	}

}
